def myAtoi(s):
        """
        :type str: str
        :rtype: int
        """
        s = s.lstrip()
        single = ''
        n = ''
        max1 = 2**31-1
        min1 = -2**31
        for c in s:
            if c in ['+', '-']:
                sigle = c
            elif not c.isdigit():
                break
            else:
                n += c
        if not c:
            return 0
        if single == '-':
            if min1 <= -int(n) <= max1:
                return -int(n)
            elif -int(n) <= min1:
                return min1
        else:
            if min1 <= int(n) <= max1:
                return int(n)
            elif int(n) >= max1:
                return max1


s = myAtoi('-42')
print(s)